package main

import (
	app "dtf/service_control_center/components"
	_ "github.com/lib/pq"
)

func TestControlCenter() {
	s := app.TControlCenterComponent{}
	s.InitInstance()
	s.RunServer()
}

func TestAgent() {
	//初始化
	a := app.TAgentComponent{
		Config: app.TAgentConfig{
			Name:                "TestAgent",
			Uid:                 "001",
			HttpEnabled:         true,
			HttpHost:            "0.0.0.0",
			HttpPort:            9999,
			HttpMessageEndpoint: "/message",
			MqttEnabled:         true,
			MqttHost:            "127.0.0.1",
			MqttPort:            1883,
			MqttUser:            "emqx",
			MqttPassword:        "public",
			MqttResultTopic:     "agent_response",
			MqttMessageTopic:    "agent_message",
			MqttNotifyTopic:     "agent_notify",
		},
	}
	//测试保存成JSON文件
	_ = a.Config.SaveToJsonFile("./config.json")
	//初始化并运行
	_ = a.InitAndRun()
}
func main() {
	//TestControlCenter()
	TestAgent()
}
